﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EmployeeForm.ascx.cs" Inherits="AGR.Web.Controls.Form.AddEmployee" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<%@ Register TagPrefix="uc" TagName="Message" Src="~/Controls/Message/Message.ascx" %>

<div>
    <asp:UpdatePanel ID="EmployeeFormUpdatePanel" runat="server">
    <ContentTemplate>
        
        <div style="width: 810px">
            <uc:Message ID="ucMessage" runat="server" />
        </div>

        <table class="form-border-large">
            <tr>
                <td>Employee code:</td>
                <td>
                    <asp:TextBox ID="txtEmployeeCode" runat="server" TabIndex="1"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="EmployeeCodeRequiredFieldValidator" runat="server" ControlToValidate="txtEmployeeCode" ErrorMessage=" * " 
                         ToolTip="Employee code is required." ValidationGroup="AddEmployee"/>
                </td>
                <td>Physical address:</td>
                <td rowspan="3">
                    <textarea id="txtPhysicalAddress" runat="server" class="textarea-address" cols="20" rows="4" tabindex="12"></textarea>
                    <asp:RequiredFieldValidator ID="PhysicalAddressRequiredFieldValidator" runat="server" ControlToValidate="txtPhysicalAddress" ErrorMessage=" * " 
                         ToolTip="Physical address is required." ValidationGroup="RegisterStudent" />
                </td>
            </tr>
            <tr>
                <td>First name:</td>
                <td>
                    <asp:TextBox ID="txtFirstName" runat="server" TabIndex="2"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="FirstNameRequiredFieldValidator" runat="server" ControlToValidate="txtFirstName" ErrorMessage=" * " 
                         ToolTip="First name is required." ValidationGroup="AddEmployee"/>
                </td>
            </tr>
            <tr>
                <td>Last name:</td>
                <td>
                    <asp:TextBox ID="txtLastName" runat="server" TabIndex="3"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="LastNameRequiredFieldValidator" runat="server" ControlToValidate="txtLastName" ErrorMessage=" * " 
                         ToolTip="Last name is required." ValidationGroup="AddEmployee"/>
                </td>
            </tr>
            <tr>
                <td>ID number:</td>
                <td>
                    <asp:TextBox ID="txtIdNumber" runat="server" TabIndex="4"></asp:TextBox>
                    <ajaxToolkit:FilteredTextBoxExtender ID="fteIdNmuber" runat="server" TargetControlID="txtIdNumber" FilterType="Numbers"></ajaxToolkit:FilteredTextBoxExtender>
                    <asp:RequiredFieldValidator ID="IdNmuberRequiredFieldValidator" runat="server" ControlToValidate="txtIdNumber" ErrorMessage=" * " 
                         ToolTip="ID number is required." ValidationGroup="AddEmployee"/>
                </td>
                <td>Postal address:</td>
                <td rowspan="4">
                    <asp:CheckBox ID="chkSameAddress" runat="server" Text="Same as physical address" 
                        AutoPostBack="true" oncheckedchanged="chkSameAddress_CheckedChanged" TabIndex="13" /> 
                    <br />
                    <textarea id="txtPostalAddress" runat="server" class="textarea-address" cols="20" rows="4" tabindex="14"></textarea>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtPostalAddress" ErrorMessage=" * " 
                         ToolTip="Postal address is required." ValidationGroup="AddEmployee" />
                </td>
            </tr>
            <tr>
                <td>Gender</td>
                <td>
                    <asp:RadioButton ID="rbtnMale" Text="Male" Checked="true" 
                        GroupName="GenderGroup" runat="server" TabIndex="5" />
                    <asp:RadioButton ID="rbtnFemale" Text="Female" GroupName="GenderGroup" 
                        runat="server" TabIndex="6" />
                </td>
            </tr>
            <tr>
                <td>HireDate</td>
                <td>
                    <asp:TextBox ID="txtHireDate" runat="server" TabIndex="7"></asp:TextBox>
                        <asp:ImageButton ID="ibtnHireDate" runat="server" ImageUrl="~/Content/Images/Buttons/calendar.png" TabIndex="8" />
                        <ajaxToolkit:CalendarExtender ID="HireDateCalendarExtender" CssClass="myCalendar" PopupButtonID="ibtnHireDate" Format="dd MMMM yyyy" TargetControlID="txtHireDate" runat="server" />
                    <asp:RequiredFieldValidator ID="HireDateRequiredFieldValidator" runat="server" ControlToValidate="txtHireDate" ErrorMessage=" * " 
                         ToolTip="ID number is required." ValidationGroup="AddEmployee"/>
                </td>
            </tr>
            <tr>
                <td>Type:</td>
                <td>
                    <asp:DropDownList ID="ddlType" CssClass="ddl-normal" 
                        runat="server" TabIndex="9">
                        <asp:ListItem Text="Permanent">Permanent</asp:ListItem>
                        <asp:ListItem Text="Zimbabwe">Tenant</asp:ListItem>
                        <asp:ListItem Text="Botswana">Botswana</asp:ListItem>
                        <asp:ListItem Text="Other">Other</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>Trainer:</td>
                <td>
                    <asp:CheckBox ID="chkIsTrainer" runat="server" AutoPostBack="true" oncheckedchanged="chkIsTrainer_CheckedChanged" TabIndex="10" /> 
                </td>
            </tr>
            <tr>
                <td>    
                    <asp:Label ID="lblTrainerSpecialization" Visible="false" runat="server" Text="Specialization:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtTrainerSpecialization" Visible="false" runat="server" TabIndex="11"></asp:TextBox>
                </td>
            </tr>
            
            <tr>
                <td>
                    <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="button" TabIndex="15"
                        ValidationGroup="AddEmployee" onclick="btnSave_Click"/>
                    <asp:Button ID="btnClear" runat="server" Text="Clear" CssClass="button" TabIndex="16" onclick="btnClear_Click"/>
                </td>
                <td>
                    <asp:Button ID="btnReset" runat="server" Text="Reset" Visible="false" CssClass="button" TabIndex="17" onclick="btnReset_Click"/>
                </td>
            </tr>
        </table>

    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
    </Triggers>
    </asp:UpdatePanel>

    <asp:UpdateProgress ID="EmployeeFormUpdateProgress" runat="server" AssociatedUpdatePanelID="EmployeeFormUpdatePanel">
    <ProgressTemplate>
        <div class="modalpopup">
            <div class="loadingpopup">
            <p>
                <img src="<%=ResolveUrl("~/Content/Images/Shared/spinner.gif") %>" alt="loading..." /> Saving...
            </p>
            </div>
        </div>
    </ProgressTemplate>
    </asp:UpdateProgress>
</div>